package com.aner.test.controller;
import com.aner.tester.controller.BaseControllerTest;
import org.junit.Test;
import org.junit.runner.RunWith;
import com.aner.tester.utils.text.StringUtils;
import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;


/**
 * GetTestControllerTest class
 * 
 * @author aner
 * @date 2020-12-27
 */
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
@RunWith(SpringRunner.class)
@AutoConfigureMockMvc
public class GetTestControllerTest extends BaseControllerTest
{

    @Test
    public void testTest() {
        String params = "{'booleanTest':true,'byteTest':0,'dateTest':'2020-12-27 21:28:36','doubleTest':0.2836476236885681,'floatTest':0.8438334,'intTest':0,'longTest':3,'stringTest':'广四的个的'}";
        String jsonStr = StringUtils.replaceSingleQuoteWithDouble(params);
                    this.get("/test/", jsonStr);
        
    }
    @Test
    public void testRequestParamListTest() {
        String params = "{'testList':['小小','公猫尔安','52事小告','44小3广故','43司']}";
        String jsonStr = StringUtils.replaceSingleQuoteWithDouble(params);
                    this.get("/testRequestParamList/", jsonStr);
        
    }
    @Test
    public void testRequestParamDateTest() {
        String params = "{'testDate':'2020-12-27 21:28:36'}";
        String jsonStr = StringUtils.replaceSingleQuoteWithDouble(params);
                    this.get("/testRequestParamDate/", jsonStr);
        
    }
    @Test
    public void testDateTest() {
        String params = "{'test':'2020-12-27 21:28:36'}";
        String jsonStr = StringUtils.replaceSingleQuoteWithDouble(params);
                    this.get("/testDate/", jsonStr);
        
    }
    @Test
    public void testPathVariableTest() {
        String params = "{'params':['猪个','个三猪','小猪的狗省','故故小事','个小小猫小猪'],'id':[3,3,3,1,1]}";
        String jsonStr = StringUtils.replaceSingleQuoteWithDouble(params);
                    this.get("/testPathVariable/{params}/{id}", jsonStr);
        
    }
}
